#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
sys.path.append('../../src')
import nubox
from nubox.const import xrange, ISJYTHON
from nubox.char import CharVector
from array import array

from time import time

fh = open('chr1_short.raw', 'rb')
large_string = "".join([l.rstrip() for l in fh.readlines()])

if not ISJYTHON:

    start = time()
    for i in range(10000):
        array('c', large_string)
    stop = time()
    print '(python) str -> array: %f' % (stop - start)
else:
    from jarray import array as ja
    start = time()
    for i in range(10000):
        ja(large_string, 'c')
    stop = time()
    print '(jython) str -> array: %f' % (stop - start)






#start = time()
#for i in range(1000):
#    list(large_string)
#stop = time()
#print 'str -> list: %f' % ((stop - start) * 100)
#
#start = time()
#for i in range(100000):
#    nubox.NdArray(large_string, shape=(len(large_string), 1), typecode='c')
#stop = time()
#print 'str -> NdArray: %f' % ((stop - start) * 1)
#
#start = time()
#for i in range(100000):
#    nubox.char.CharVector(large_string, shape=(len(large_string), 1), childrenkwargs='NOCHILDREN')
#stop = time()
#print 'str -> CharVector: %f' % ((stop - start) * 1)
